package com.pig.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016103000779690";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCTbe1l1FTEh2fIdHMhvDpfAvXno5stZcYjQGxwRArEvpMuuCEUUqjJeBuXD3ZMRoqooUvdf/OxXL7cYJgdNvnKGpNSnUoCHTccVKm6CJqlZ5MNvOGTNFA/gtRsJyceIeAyMfEQJMJB+DUAMEwrQPYvmrTm3QrnvoMZ/5dpT5hIDZm+U9e3QoAq0Dq5NTwh24TIS19n4X3ftzrow8aQ5zsU8iY/qV781Xc/mlCPcaP1iDQQf0DGUf7Ux+BAQ2WtpoxIgDpxsoGNfQ5DbapT0l0eSS2ph1zd/r0QOhcQ12gG2xH7RT8vPjbBmGeGGmMc9L2rhaqoySzSOhqjzgOkeCcZAgMBAAECggEASo17UFQ4bY2foNGqavPZfLRtj66/SQy/TpJEg90UqPtKSITaTYGjUwZGxXQPOXEuqymtyJvsqtMgvSanpZZoaJhZyZw6kakedlgl4Cp7sYsX5QmP9LWuov9Q1kRSVr2At0FkCurbxSpz+t1xlynplJciReCfpCNF/r6uXZXfhwd9JiXM7PiznK4hExuaHCnTqFATiieVSRhJnZESzeckg3sLbm+Urt9QLvEGFKrA8FXeubDPEhu5fxCWkLujK7+wvIE1QfcxrUUkrNmIwj2u14hp5xzVsEzmFsBuFKkk1wsAuWhImC/tGSQgdOuIUgYRwDytR7rHVBBFOIABpPITgQKBgQDFcFLah3Ohg12P6F0cdlDLp3no2TF8BlUMaVKyORaSgx6rj9iy0scWl4TpyKTXPjpI7FN8j3SKtTLKNH9kPSL5zqtQaFUKNKljlvYkBEVYjJk8FdJtdeFjjr1hWpT8gAwZiQ5mYwoq+1lb/ofTsuxE6ds4RVxfBmXjitM/rl4x8QKBgQC/KFrNUcCyyIbKqZE51cPPImlaPMCG1IM6xfYzrI/Ot2rR2N0H6cmqxZj7TJ0wPxaeK1nGngc9JjOgyNSnHu+SyIumAz5mlrug1SiHSyL/WnRiRETyJdtBVKJgSQRPhA9Ld3eGUZw/jTq+3OP1usRtfeEgBKTiQoMqtYoWBw0fqQKBgQC6POC6p8hH0v1fcITcAzLlV53kKXPHFMYGxhaubLFBFJPKqw5yZ+ZKBjTmvU/YhSc/gESkG0GIUbGOEQUVjaG/V9Y7K58D2HbrrQuTH8A17bHhfogWnnozigJTobklkLdZIvJFXCjMMHmzEB4ZcA30V09k/fBK5mMXxuzLhfPuUQKBgBlfhuX38wcIHPQrm848dJg67hb/N2LuNFkJy8tCHXiH2hLuoTAatR0Iy2yX18l+pkbqZCk78qQIPRQbdDaWoaAvJHItvgup+E+5235R19xjKk2c2DX4FmlOjZsQNhVD5y/SNLhMftvkqCaLdWq5lrcd3VL9qtEpmPWDUUfpObG5AoGAEdxsDTY8ofbdKKUOffYN9nxlK8YpQko8/rlf8c4M+QXwhJvPpdzbq5NoyTZ0yKbayEvwC/04/6V7EhKfBvM2L//BxgDxhQ0MxDsouxDusdsucbQ6CnGn17r8YVx/NvnM56Bgia1n6HOAB2hZbmuPsputgn7ZDo0g1b1lW2rd73M=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4b1ttzOcL9RzzPuYzTMKKFxJ6jd6Bl5qSkMcYoMhIXIaztNtlxv9GG58kfRDTvdP8aQPZndJe4LeyqER1rfSWVUrgtFbA28bYidCU8ygwtCgv58XvBkUtkvGAx06j9oZd6GGl3TsMsRAkpEmjISJhnWoDKuEkayKhRduRv/IGv+y892A6vPJ5IFgYIMUq3E4buUdVA/1kPA7cdPzX4101Qe60XVACxOaKYC83uaWKCi/Sud2xAVH39UfBWkFDsqOLPdW1xYTl8r5S/QRw9azyT+OXRmAN4pKZxnW4ckqWlXm8NZ+LsofOaA0uaPLV4FwbeXxJ52k2th5+1XtK/kwmQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://????????/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://????????/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
	public static String sign_type = "RSA2";

    // 字符编码格式
	public static String charset = "utf-8";

    // 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

